When a computer program is generated, the programming process may be carried out efficiently by referring to programming experiences that have been accumulated. Programming experiences of a programmer can be accumulated by accumulating programs that have been generated by the programmer himself.
Heretofore, computer programs have been generated on the basis of directly reusing programs that are described in high-level languages (e.g., 4 GL) designed for respective application fields. While it has been customary practice to reuse documents such as specifications, the procedure for reusing such documents is not necessarily automatized.
There has been known a language transforming apparatus which employs a knowledge base, for transforming a first linguistic description which represents desired information processing in a certain application field that is stated in a language used in the application field, into a second linguistic description expressed in a certain computer program language (Japanese laid-open patent publication No. 63-269228). According to the disclosed language transforming apparatus, one first linguistic description can be transformed into several second linguistic descriptions, e.g., an application-side abstract program linguistic description and a computer program linguistic description. Since the first linguistic description can thus be transformed into different second linguistic descriptions, the first linguistic description can be reused.
FIG. 1 of the accompanying drawings is a diagram showing a basic arrangement of such a language transforming apparatus which employs a knowledge base. As shown in FIG. 1, the language transforming apparatus comprises a first linguistic description 1, a first role pattern accumulating means 2 for accumulating role patterns 3, a second linguistic description 4, a second role pattern accumulating means 5 for accumulating other role patterns 6, a role assignment knowledge accumulating means 7 for accumulating role assignment knowledges 8 which represent the corresponding relationship between the role patterns 3, 6 that are accumulated in the first and second role pattern accumulating means 2, 5, and a language transforming means 9 for transforming the first linguistic description 1 into the second linguistic description 4 by referring to the role patterns 3, 6 and the role assignment knowledges 8.
The language transforming means 9 is capable of obtaining the second linguistic description 4 which is desired from the first linguistic description 1 which is given, by using the role patterns 3 for understanding the first linguistic description 1 and the first role pattern accumulating means 2 for storing the role patterns 3, using the role patterns 6 for understanding the second linguistic description 4 and the second role pattern accumulating means 5 for storing the role patterns 6, and referring to the role assignment knowledges 8 that represent assignments between the roles of role patterns in a first language and the roles of role patterns in a second language and the role assignment knowledge accumulating means 7.
FIG. 2 of the accompanying drawings illustrates, by way of example, an arrangement of the language transforming apparatus based on the basic arrangement shown in FIG. 1. In the arrangement shown in FIG. 2, the linguistic form of an intermediate output of an information processing description is employed as the form of the first linguistic description shown in FIG. 1. An information processing description from an application side is supplied as a description in compliance with the linguistic form of an information processing description intermediate output 11 to the language transforming apparatus, in which the supplied information processing description is transformed into a computer program intermediate output 13 by an intermediate output transforming processor 12. The computer program intermediate output 13 is then passed through a linguistic description generating processor 14, which generates a computer program linguistic description 15 as the second linguistic description shown in FIG. 1. As with the computer program linguistic description 15, an information processing linguistic description 17 from an application object side is generated as the second linguistic description shown in FIG. 1 by a linguistic description generating processor 16.
As described above, the above invention (Japanese laid-open patent publication No. 63-269228) has shown that a conversion from the first linguistic description form into the second linguistic description form can be achieved by the language transforming apparatus. However, it does not necessarily reveal a specific example of means for achieving such a conversion.
According to the conventional programming technology, accumulated programs are hardly used as they are, but are mostly required to be rewritten, because of changes arising from circumstances of the application side, changes arising from circumstances of the computer side, and changes of program languages.
One program has three aspects, i.e., an aspect as seen from the application object side (an aspect as seen from the user), an aspect as seen from the computer side (an aspect as seen from the executing side), and an aspect of implementation. Rewriting a program requires that the program be understood simultaneously with respect to these three aspects. Such a requirement is, however, responsible for increasing the difficulty in rewriting the program. From the standpoint of rewriting a program, the program should have been written in expressions that can easily be understood with respect to the aspect as seen from the application object side, which is not necessarily the case, however. For example, it is not necessarily simple to establish a sequence of cause and effect about what change of a program is brought about by a program modification that is required under the circumstances of the application side. As a result, a process of rewriting a program may become more difficult than a process of newly creating such a program, or an erroneous program may be produced due to a program rewriting error.
Therefore, it has been desired to be capable of writing a program in expressions that can easily be understood from the application object side, using user's own words, and of automatically generating expressions in an indicated programming language from a program that has been written using user's own words.